﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Dracham.MapEditor.Zones.Extras
{
    public class SpawnPoint
    {
        public String Type { get; set; }
        public Int32 Id { get; set; }
        public Int32 Interval { get; set; }

        public SpawnPoint( XmlNode node)
        {
            this.Type = node.Attributes["Type"].Value;
            this.Id = Convert.ToInt32(node.Attributes["Id"].Value);
            this.Interval = Convert.ToInt32(node.Attributes["Interval"].Value);
        }

        public SpawnPoint(String type, Int32 id, Int32 interval)
        {
            this.Type = type;
            this.Id = id;
            this.Interval = interval;
        }

        public XmlNode ToXmlNode()
        {
            XmlNode node = Singleton.DrachamMapEditor.ZoneManager.CreateElement("Spawn");
            node.Attributes.Append(Singleton.DrachamMapEditor.ZoneManager.CreateAttribute("Id", this.Id.ToString()));
            node.Attributes.Append(Singleton.DrachamMapEditor.ZoneManager.CreateAttribute("Interval", this.Interval.ToString()));
            node.Attributes.Append(Singleton.DrachamMapEditor.ZoneManager.CreateAttribute("Type", this.Type.ToString()));

            return node;
        }
    }
}
